package com.xjy.controller;


import com.xjy.model.auto.RecruitmentInfo;
import com.xjy.service.IRecruitmentInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 招聘详情表 前端控制器
 * </p>
 *
 * @author 达瓦里氏
 * @since 2021-11-13
 */
@RestController
@RequestMapping("/recruitment-info")
@CrossOrigin
public class RecruitmentInfoController {

    @Autowired
    private IRecruitmentInfoService recruitmentInfoService;

//    查询用户
    @GetMapping("/getRecruitment")
    public List<RecruitmentInfo> getRecruitmentInfo(){
        return recruitmentInfoService.list();
    }

//    通过id查询用户
    @GetMapping("/getRecruitmentById/{id}")
    public RecruitmentInfo getRecruitmentInfoById(@PathVariable("id") int id){
        return recruitmentInfoService.getById(id);
    }

//    修改用户
    @PostMapping("/updateRecruitment")
    public void updateRecruitmentInfo(@RequestBody RecruitmentInfo recruitmentInfo){
        recruitmentInfoService.updateById(recruitmentInfo);
    }

//    添加用户
    @PostMapping("/setRecruitment")
    public void setRecruitmentInfo(@RequestBody RecruitmentInfo recruitmentInfo){
        recruitmentInfoService.save(recruitmentInfo);
    }

    /*删除用户*/
    @PostMapping("/deletedById/{id}")
    public boolean deleted(@PathVariable("id") int id){
        return recruitmentInfoService.removeById(id);
    }

}
